import { createBrowserRouter } from 'react-router-dom'
import App from '../App'
const routes = createBrowserRouter([
    {
        path: '/',
        element: <App />,
        children: [
            {
                index: true,
                lazy: async () => {
                    const { default: Index } = await import('../pages/index/Index')
                    return {
                        element: <Index />
                    }
                }
            },
            {
                path: 'index',
                lazy: async () => {
                    const { default: Index } = await import('../pages/index/Index')
                    return {
                        element: <Index />
                    }
                }
            },
            {
                path: 'Moments',
                lazy: async () => {
                    const { default: Moments } = await import('../pages/Moments/Index')
                    return {
                        element: <Moments />
                    }
                }
            },
            {
                path: 'momentsDetail/:sickCircleId',
                lazy: async () => {
                    const { default: MomentsDetail } = await import('../pages/Moments/momentsDetail/Index')
                    return {
                        element: <MomentsDetail />
                    }
                }
            },
            {
                path: 'vvideo',
                lazy: async () => {
                    const { default: Video } = await import('../pages/vvideo/Index')
                    return {
                        element: <Video />
                    }
                }
            },
        ]
    },
    {
        path: 'login',
        lazy: async () => {
            const { default: Login } = await import('../pages/login/Index')
            return {
                element: <Login />
            }
        }
    },
    {
        path: 'search',
        lazy: async () => {
            const { default: Search } = await import('../pages/search/Index')
            return {
                element: <Search />
            }
        }
    },
    // 咨询详情
    {
        path: 'consultDetail/:infoId',
        lazy: async () => {
            const { default: ConsultDetail } = await import('../pages/index/consultDetail/Index')
            return {
                element: <ConsultDetail />
            }
        }
    },
    // 症状页
    {
        path: 'symptoms',
        lazy: async () => {
            const { default: Symptoms } = await import('../pages/symptoms/Index')
            return {
                element: <Symptoms />
            }
        }
    },
    
    // 病症药品详情页
    {
        path: 'symptomsDetail/:id',
        lazy: async () => {
            const { default: SymptomsDetail } = await import('../pages/symptoms/symptomsDetail/Index')
            return {
                element: <SymptomsDetail />
            }
        }
    },
    {
        path: 'medicineDetail/:id',
        lazy: async () => {
            const { default: MedicineDetail } = await import('../pages/symptoms/medicineDetail/Index')
            return {
                element: <MedicineDetail />
            }
        }
    },

])
export default routes